package Cantella::DJabberd::Web::Controller::Admin::LoggedMessage;

#the order the following IS RELEVANT
use base 'Cantella::DJabberd::Web::UI::Controller::Collection';
use aliased 'Reaction::UI::ViewPort::ListView';
use Reaction::Class;

__PACKAGE__->config
  (
   model_name => 'Admin',
   collection_name => 'logged_messages',
   action =>
   { base => { Chained => '/admin/base', PathPart => 'message' },
     list =>
     { ViewPort =>
       { excluded_fields => [qw/id/],
         field_order => [qw/from to delivery_d message/],
         Member =>
         { Field => {
                     to => { controller => 'Admin::UserJid' },
                     from => { controller => 'Admin::UserJid' },
                    },
         },
       },
     },
     view =>
     { #PathPart => "",
      ViewPort =>
      { field_order => [qw/from to delivery_d message/],
        excluded_fields => [qw/id/],
        Field => {
                  to => { controller => 'Admin::UserJid' },
                  from => { controller => 'Admin::UserJid' },
                 },
      },
     },
   },
  );

sub base :Action :CaptureArgs(0) {
  my ($self, $c) = @_;
  $c->stash->{submenu}->current_item('messages');
}

1;
